package com.albon.util;
/*
 * 동일하게 적용되는 설정값 데이터 저장은 DB대신 SharedPreferences 를 사용한다. 
 */
import android.content.Context;
import android.content.SharedPreferences;

public class Shared {
	SharedPreferences pref;
	public Shared(Context context) {
		pref = context.getSharedPreferences("albon_sport_alarm", Context.MODE_PRIVATE);
	}
	public void clearPref(){
		SharedPreferences.Editor editor  = pref.edit();
		editor.clear();
		editor.commit();
	}

	public void setString(String KeyValue, String saveValue){
		SharedPreferences.Editor editor = pref.edit();
		editor.putString(KeyValue, saveValue);
		editor.commit();
	}

	public String getString(String KeyValue, String defValue){
		return pref.getString(KeyValue, defValue);
	}

	public void setInt(String KeyValue,int saveValue){
		SharedPreferences.Editor editor = pref.edit();
		editor.putInt(KeyValue, saveValue);
		editor.commit();
	}

	public int getInt(String KeyValue,int defValue){
		return pref.getInt(KeyValue, defValue);
	}

	public void setBoolean(String KeyValue, boolean saveValue){
		SharedPreferences.Editor editor = pref.edit();
		editor.putBoolean(KeyValue, saveValue);
		editor.commit();
	}

	public boolean getBoolean(String keyValue, boolean defValue){
		return pref.getBoolean(keyValue, defValue);
	}
}
